import { Button } from 'antd';
import dayjs from 'dayjs';
import React from 'react';
export default [
  {
    type: 'INPUT',
    label: '节点名称',
    name: 'name',
    inputProps: {
      allowClear: true,
      placeholder: '请输节点名称',
      className: 'search-input',
    },
  },
  {
    label: '使用时长',
    value: '',
    props: 'time',
    type: 'SELECT',
    inputProps: {
      options: [
        { label: '1周', value: '1week' },
        { label: '1月', value: '1month' },
        { label: '1年', value: '1year' },
      ],
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: '请选择使用时长',
      },
    ],
  },
  {
    type: '负责人',
    label: '',
    name: 'ownerId',
    inputProps: {
      allowClear: true,
      remote: async (val: string) => {
        if (!val) return [];
        return [
          { label: val, value: val },
          { label: `${val}1`, value: `${val}1` },
          { label: `${val}2`, value: `${val}2` },
          { label: `${val}3`, value: `${val}3` },
        ];
      },
      className: 'search-ownerId',
      placeholder: '请输入负责人ID',
    },
  },
  {
    type: 'DATERANGER',
    label: '使用时间',
    name: 'createTm',
    inputProps: {
      allowClear: true,
      disabledDate: (current) => {
        return current && current > dayjs().endOf('day');
      },
      renderExtraFooter: () => {
        return (
          <div style={{ padding: 10 }}>
            <Button style={{ marginRight: 10 }} type="primary">
              最近一周
            </Button>
            <Button style={{ marginRight: 10 }} type="primary">
              最近一月
            </Button>
            <Button style={{ marginRight: 10 }} type="primary">
              最近一年
            </Button>
          </div>
        );
      },
    },
  },
];
